package org.yocastlong.mybatisplus.common;

/**
 * @author 朱海龙
 * 2025/6/6 16:01
 */
public class MybatisPlusGenerator {

    //排除生成的表 自定义
    private static final String[] excludeTable = new String[]{""};
    //需要生成的表 自定义
    private static final String[] includeTable = new String[]{"t_area_info"};

    //包名
    private static final String PACKAGE_NAME = "org.yocastlong.mybatisplus.common";
    //模块名称
    private static final String MODULE_NAME  = "user";

    //dao层代码生成存放路径  如：com.hm.dubbopractice.dubboserver.thirdSystem;
    private static final String DAO_PATH = "dao";

    //dao层生成 存放路径 如：com.hm.dubbopractice.dubboserver.dao;
    private static final String MAPPER_PATH = DAO_PATH + ".mapper";

    //entity bean对象生成 存放路径  如：com.hm.dubbopractice.dubboserver.entity;
    private static final String ENTITY_PATH = "domain";

    //thirdSystem impl层代码生成存放路径  如：com.hm.dubbopractice.dubboserver.thirdSystem.impl;
    private static final String DAO_IMPL_PATH = DAO_PATH + ".impl";

    //代码输出文件的路径
    private static final String MAC_OUT_PATH     = "/Users/castlong/codespace/study-java/study-mybatis/mybatis-plus-common-dao/src/test/java";
    private static final String WINDOWS_OUT_PATH = "D:\\code\\java-study\\study-mybatis\\mybatis-plus-common-dao\\src\\test\\java";
    //代码生成者
    private static final String AUTHOR           = "castlong";

    /**
     * JDBC相关配置
     */
    private static final String DRIVER    = "com.mysql.jdbc.Driver";
    private static final String URL       = "jdbc:mysql://localhost:3307/study_shiro";
    private static final String USER_NAME = "root";
    private static final String PASSWORD  = "Castlong68949233";

    public static void main(String[] args) {

        String osName = System.getProperty("os.name").toLowerCase();
        final String OUT_PATH;
        if (osName.contains("win")) {
            OUT_PATH = WINDOWS_OUT_PATH;
        } else {
            OUT_PATH = MAC_OUT_PATH;
        }
        //FastAutoGenerator.create(URL, USER_NAME, PASSWORD)
        //                 .globalConfig(builder -> builder.author(AUTHOR).outputDir(OUT_PATH).commentDate("yyyy-MM-dd"))
        //                 .packageConfig(builder -> builder.parent(PACKAGE_NAME).entity("domain").mapper("dao.mapper")
        //                                                  .service("dao").serviceImpl("dao.impl"))
        //                 .strategyConfig(builder -> {
        //                     builder.entityBuilder().idType(IdType.ASSIGN_ID).formatFileName("%sDO")
        //                            .enableLombok(new ClassAnnotationAttributes(Data.class));
        //                     builder.serviceBuilder().formatServiceFileName("%sDao")
        //                            .formatServiceImplFileName("%sDaoImpl");
        //                     builder.mapperBuilder().disableMapperXml().formatMapperFileName("%sMapper");
        //                     builder.addInclude(includeTable).addTablePrefix("t_");
        //                     builder.controllerBuilder().disable();
        //                 }).execute();

    }


}
